import {$Storage} from "@utils/storage.js"

export default {
    namespaced:true,
    state:{
        userInfo:null,
        keyName:"userInfo"
    },
    getters:{
        getUserInfo(state){//获取用户信息
            state.userInfo = $Storage.getItem(state.keyName)
        }
    },
    mutations:{
        setUserInfo(state,payload){//设置用户信息
            state.userInfo = payload
            $Storage.setItem(state.keyName,payload)
        },
        removeUserInfo(state){//删除用户信息
            state.userInfo = null
            $Storage.setItem(state.keyName,null)
        }
    }
}